package com.example.demo.service.impl;

import com.example.demo.entity.User;
import com.example.demo.jpa.UserJPA;
import com.example.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.UUID;

@Service
public class UserServiceImpl implements UserService {


    @Autowired
    private UserJPA userJPA;

    @Override
    public void login(String usercode) {
        userJPA.findByName(usercode);
        User user = new User();
        user.setName("" + UUID.randomUUID());

        // 加这个会报错

//        try {
//            Thread.sleep(500L);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
        userJPA.save(user);
    }

}
